﻿using System.Collections.Generic;
using System.ServiceModel;

namespace Metro.Kashikoi.ServiceContract.Storage
{
    /// <summary>
    /// WCF client of the <c>IStorageService</c>.
    /// </summary>
    public class StorageServiceClient : ClientBase<IStorageService>, IStorageService
    {
        #region Constructors

        /// <summary>
        /// Initializes a new instance of the <see cref="StorageServiceClient"/> class.
        /// </summary>
        public StorageServiceClient() :
            base("storage")
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="StorageServiceClient"/> class.
        /// </summary>
        /// <param name="remoteAddress">The remote address.</param>
        public StorageServiceClient(string remoteAddress) :
            base("storage", remoteAddress)
        {
        }

        #endregion

        #region IStorageService Members

        /// <summary>
        /// Creates the inventory.
        /// </summary>
        /// <param name="inventory">The inventory to be created.</param>
        /// <param name="stockAreaId">The stock area id.</param>
        /// <returns>
        /// The newly created inventory.
        /// </returns>
        public BinInventory CreateInventory(BinInventory inventory, int stockAreaId)
        {
            return base.Channel.CreateInventory(inventory, stockAreaId);
        }

        /// <summary>
        /// Updates the inventory.
        /// </summary>
        /// <param name="inventory">The inventory to be updated.</param>
        public void UpdateInventory(BinInventory inventory)
        {
            base.Channel.UpdateInventory(inventory);
        }

        /// <summary>
        /// Updates the inventories stock status.
        /// </summary>
        /// <param name="inventories">The inventories.</param>
        /// <param name="stockStatus">The stock status.</param>
        public void UpdateInventoriesStockStatus(ICollection<BinInventory> inventories, StockStatus stockStatus)
        {
            base.Channel.UpdateInventoriesStockStatus(inventories, stockStatus);
        }

        /// <summary>
        /// Updates the inventory stock status.
        /// </summary>
        /// <param name="SSID">The SSID.</param>
        /// <param name="stockStatus">The stock status.</param>
        public void UpdateInventoryStockStatus(string SSID, StockStatus stockStatus)
        {
            base.Channel.UpdateInventoryStockStatus(SSID, stockStatus);
        }

        /// <summary>
        /// Deletes the inventory.
        /// </summary>
        /// <param name="inventoryId">The inventory id.</param>
        public void DeleteInventory(int inventoryId)
        {
            base.Channel.DeleteInventory(inventoryId);
        }

        /// <summary>
        /// Deletes the inventories of stock areas.
        /// </summary>
        /// <param name="stockAreaIdList">The stock area id list.</param>
        public void DeleteInventoriesOfStockAreas(IEnumerable<int> stockAreaIdList)
        {
            base.Channel.DeleteInventoriesOfStockAreas(stockAreaIdList);
        }

        /// <summary>
        /// Deletes the inventories of items.
        /// </summary>
        /// <param name="itemIdList">The item id list.</param>
        public void DeleteInventoriesOfItems(IEnumerable<int> itemIdList)
        {
            base.Channel.DeleteInventoriesOfItems(itemIdList);
        }

        /// <summary>
        /// Gets the inventories of the specific stock areaId.
        /// </summary>
        /// <param name="stockAreaId">The stock area id.</param>
        /// <returns>
        /// A list of inventory.
        /// </returns>
        public IList<BinInventory> GetInventoriesOfStockArea(int stockAreaId)
        {
            return base.Channel.GetInventoriesOfStockArea(stockAreaId);
        }

        /// <summary>
        /// Gets the inventories of the specific stock areaId.
        /// </summary>
        /// <param name="stockAreaIdList">The stock area id list.</param>
        /// <returns>
        /// A list of inventory.
        /// </returns>
        public IList<BinInventory> GetInventoriesOfStockAreas(IEnumerable<int> stockAreaIdList)
        {
            return base.Channel.GetInventoriesOfStockAreas(stockAreaIdList);
        }

        /// <summary>
        /// Gets the list of inventory to be restocked in the specific regions.
        /// </summary>
        /// <param name="stockAreaIdList">The region id list.</param>
        /// <returns>
        /// A list of inventory to be restocked.
        /// </returns>
        public IList<BinInventory> GetRestockList(IEnumerable<int> stockAreaIdList)
        {
            return base.Channel.GetRestockList(stockAreaIdList);
        }

        /// <summary>
        /// Gets the inventory by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns>
        /// The inventory.
        /// </returns>
        public BinInventory GetInventoryById(int id)
        {
            return base.Channel.GetInventoryById(id);
        }

        /// <summary>
        /// Gets the inventory by SSID.
        /// </summary>
        /// <param name="SSID">The SSID.</param>
        /// <returns>
        /// The inventory.
        /// </returns>
        public BinInventory GetInventoryBySSID(string SSID)
        {
            return base.Channel.GetInventoryBySSID(SSID);
        }

        /// <summary>
        /// Gets the inventories by item.
        /// </summary>
        /// <param name="itemId">The item id.</param>
        /// <returns>
        /// A list of inventory which stock the item.
        /// </returns>
        public IList<BinInventory> GetInventoriesByItem(int itemId)
        {
            return base.Channel.GetInventoriesByItem(itemId);
        }

        /// <summary>
        /// Clones the inventory.
        /// </summary>
        /// <param name="inventoryId">The inventory id of the inventory to be cloned.</param>
        /// <returns>
        /// The newly created inventory.
        /// </returns>
        public BinInventory CloneInventory(int inventoryId)
        {
            return base.Channel.CloneInventory(inventoryId);
        }

        /// <summary>
        /// Clones the inventories of stock area.
        /// </summary>
        /// <param name="fromStockAreaId">The id of the source stock area.</param>
        /// <param name="toStockAreaId">The id of the destination stock area.</param>
        /// <returns></returns>
        public IList<BinInventory> CloneInventoriesOfStockArea(int fromStockAreaId, int toStockAreaId)
        {
            return base.Channel.CloneInventoriesOfStockArea(fromStockAreaId, toStockAreaId);
        } 

        #endregion

    }
}
